/**
* @describe 平台接口
* @author 游金宇(KM)
* @date 2023-08-02 19:48:12
*/

import { WECHAT } from 'cc/env';
import { H5API } from './H5API';
import { WXAPI } from './WXAPI';
import { error, log } from 'cc';
import { Manager } from '@shimotsuki/core';


/**平台相关 */

// 扩展 Manager 接口，添加 Platform 属性
declare module '@shimotsuki/core' {
    interface Manager {
        /**平台管理 */
        platform: MinimageAPI;
    }
}

export class Platform {
    platform: MinimageAPI
    constructor(cat: Manager) {
        if (WECHAT) {
            this.platform = new WXAPI(cat)
        } else {
            error('默认H5平台运行环境')
            this.platform = new H5API(cat)
        }
    }
}

